package com.dao;

import com.domain.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Repository
public interface UserDao {

    @Select("SELECT * FROM user WHERE userid=#{userid} AND password=#{password}")
    User findUserById(User user);

    @Select("SELECT * FROM user WHERE userid=#{userid}")
    User findUserInfo(User user);

    @Insert("INSERT INTO user (userage,username,usersex,password) VALUES (#{userage},#{username},#{usersex},#{password})")
    Integer userRegist(User user);

    @Update("UPDATE user SET username=#{username},usersex=#{usersex},password=#{password} WHERE userid=#{userid}")
    Integer updateUser(User user);

    @Select("SELECT * FROM user WHERE userid=#{userid} AND password=#{password}")
    User userLogin(User user);
}
